﻿import plugin from '../../lib/plugins/plugin.js';
import common from "../../lib/common/common.js";
import moment from "moment"

let gid = []  //需要自动续火的群号
let bid = []  //不需要自动续火的群号，与上面不冲突

let msgs = '🔥'
//1.定义命令规则
export class example extends plugin {
  constructor() {
    super({
      /** 功能名称 */
      name: '续火',
      /** 功能描述 */
      dsc: '简单开发示例',
      /** https://oicqjs.github.io/oicq/#events */
      event: 'message',
      /** 优先级，数字越小等级越高 */
      priority: 10000,
      
    })
	this.task = {
      cron: '0 0 13 * * *',
      name: '全部群聊定时续火',
      fnc: () => this.xuhuo()
    }
  }
  

  async xuhuo() {
	if (gid.length === 0) {
       let listMap = Array.from(Bot.gl.values());
       listMap.map(item => gid.push(item.group_id));
    }
		for (let id of gid) {
		    if (isNaN(id)) {
                continue
            }
		    if (bid.includes(id)) {
		    	logger.info(`${id} 黑名单不续火`)
			    continue 
		    }	
			await Bot.pickGroup(id).sendMsg(msgs)
		    await common.sleep(1000)
        }

  }

}
